<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"example.com","root":"/","images":"/images","scheme":"Muse","darkmode":false,"version":"8.8.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"}}</script><script src="/js/config.js"></script>
<meta name="description" content="起因最近在和人一起研究 apt-file 功能实现，但是我电脑中使用的系统是 fedora，所以需要一个Debian系的系统，手里恰好有一个当初女朋友送我的三星U盘，128G、USB3.0，性能应该差不多能满足需求，于是我决定在其中安装Ubuntu。 大致思路预备因为这个系统已经装好了，并且我不想再来一次，所以这里只说一下大致思路。  U盘两个（一个大于4G（1号），另一个越大越好（2号）） 系统">
<meta property="og:type" content="article">
<meta property="og:title" content="在U盘中安装Linux操作系统">
<meta property="og:url" content="http://example.com/2021/10/23/install-linux-in-upan/index.html">
<meta property="og:site_name" content="Maicss">
<meta property="og:description" content="起因最近在和人一起研究 apt-file 功能实现，但是我电脑中使用的系统是 fedora，所以需要一个Debian系的系统，手里恰好有一个当初女朋友送我的三星U盘，128G、USB3.0，性能应该差不多能满足需求，于是我决定在其中安装Ubuntu。 大致思路预备因为这个系统已经装好了，并且我不想再来一次，所以这里只说一下大致思路。  U盘两个（一个大于4G（1号），另一个越大越好（2号）） 系统">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-10-23T05:08:42.000Z">
<meta property="article:modified_time" content="2021-11-16T07:49:25.342Z">
<meta property="article:author" content="Maicss">
<meta property="article:tag" content="linux">
<meta property="article:tag" content="u盘">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="http://example.com/2021/10/23/install-linux-in-upan/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://example.com/2021/10/23/install-linux-in-upan/","path":"2021/10/23/install-linux-in-upan/","title":"在U盘中安装Linux操作系统"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>在U盘中安装Linux操作系统 | Maicss</title>
  




  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">Maicss</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
  </ul>
</nav>




</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E8%B5%B7%E5%9B%A0"><span class="nav-number">1.</span> <span class="nav-text">起因</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%A4%A7%E8%87%B4%E6%80%9D%E8%B7%AF"><span class="nav-number">2.</span> <span class="nav-text">大致思路</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%A2%84%E5%A4%87"><span class="nav-number">2.1.</span> <span class="nav-text">预备</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%BC%80%E5%A7%8B"><span class="nav-number">2.2.</span> <span class="nav-text">开始</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%BB%93%E6%9D%9F"><span class="nav-number">2.3.</span> <span class="nav-text">结束</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Maicss</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">13</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/10/23/install-linux-in-upan/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Maicss">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Maicss">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          在U盘中安装Linux操作系统
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-10-23 13:08:42" itemprop="dateCreated datePublished" datetime="2021-10-23T13:08:42+08:00">2021-10-23</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-11-16 15:49:25" itemprop="dateModified" datetime="2021-11-16T15:49:25+08:00">2021-11-16</time>
      </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h2 id="起因"><a href="#起因" class="headerlink" title="起因"></a>起因</h2><p>最近在和人一起研究 apt-file 功能实现，但是我电脑中使用的系统是 fedora，所以需要一个Debian系的系统，手里恰好有一个当初女朋友送我的三星U盘，128G、USB3.0，性能应该差不多能满足需求，于是我决定在其中安装Ubuntu。</p>
<h2 id="大致思路"><a href="#大致思路" class="headerlink" title="大致思路"></a>大致思路</h2><h3 id="预备"><a href="#预备" class="headerlink" title="预备"></a>预备</h3><p>因为这个系统已经装好了，并且我不想再来一次，所以这里只说一下大致思路。</p>
<ul>
<li>U盘两个（一个大于4G（1号），另一个越大越好（2号））</li>
<li>系统镜像文件（我用了Ubuntu）</li>
<li>电脑一台</li>
</ul>
<h3 id="开始"><a href="#开始" class="headerlink" title="开始"></a>开始</h3><p>先把下载好的Ubuntu镜像写入到较小的U盘（1号）中，然后同时插入两个U盘，引导启动安装盘（1号）。</p>
<p>安装盘启动后，在分区的步骤中，可以看到电脑中的硬盘，还有2号U盘，还有用于启动的1号启动盘。</p>
<p>忽略硬盘，在2号U盘中创建EFI分区和其他对应分区。我这里只创建了一个EFI分区和根分区。</p>
<p>然后安装系统。</p>
<p>但是这时需要注意的是，此时电脑重启后将进入一个GRUB菜单，菜单中包含了你电脑中所有的操作系统的列表，这个列表中包括我在硬盘中的双系统Window和Fedora，也包括了U盘中的Ubuntu。</p>
<p>这时候，先进入Ubuntu，启动后需要有两个步骤：</p>
<ul>
<li>将引导重新安装至U盘的EFI分区中。</li>
<li>去除多余的GRUB菜单项。</li>
</ul>
<p>首先就是要将EFI分区重新挂载好，因为很有可能在启动时挂载了硬盘中的EFI分区，现在要将其卸载并挂载为U盘中的EFI分区。</p>
<p>然后卸载掉os-prober这个包，这个东西会在使用grub-mkconfig命令时，自动将可以扫描到的其他系统也添加到启动菜单，但是作为一个U盘中的系统，这显然是画蛇添足，因此，卸载掉可保证GRUB启动菜单的纯净。</p>
<p>最后使用grub-install安装，并使用grub-mkconfig更新配置即可，有些系统中是支持直接使用update-grub命令的，这个会更方便一点。</p>
<p>关于GRUB的操作，可以参考ArchWiki。</p>
<h3 id="结束"><a href="#结束" class="headerlink" title="结束"></a>结束</h3><p>到此为止，便可以在开机时进入bios的启动菜单，然后引导进入U盘中的操作系统了。</p>
<p>不过还要注意的是，这时候电脑原来的GRUB菜单可能已经变了，只需要在原来硬盘中的操作系统下使用grub-config命令更新配置文件即可。</p>
<p>如果原来电脑没有Linux，那么其实可以直接在Bios中把Windows启动项设置为首选就好啦。</p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/linux/" rel="tag"># linux</a>
              <a href="/tags/u%E7%9B%98/" rel="tag"># u盘</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021/09/27/fedora-nvidia/" rel="prev" title="fedora安装N卡驱动后导致触控板手势失效">
                  <i class="fa fa-chevron-left"></i> fedora安装N卡驱动后导致触控板手势失效
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021/10/24/c-str-len/" rel="next" title="char**作为数组时如何获取其长度">
                  char**作为数组时如何获取其长度 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Maicss</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/muse/" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  





  





</body>
</html>
